﻿<UserControl x:Class="BillsManager.Views.DBAddEditView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:ViewModels="clr-namespace:BillsManager.ViewModels;assembly=BillsManager.ViewModels"
             mc:Ignorable="d"
             Width="350"
             d:DataContext="{d:DesignInstance Type=ViewModels:DBAddEditViewModel, IsDesignTimeCreatable=True}">

    <UserControl.Resources>
        <ResourceDictionary Source="Dictionaries\Styles.xaml" />
    </UserControl.Resources>

    <UserControl.Background>
        <Binding Mode="OneTime"
                 Source="{StaticResource ViewBackgroundBrush}" />
    </UserControl.Background>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="{StaticResource MarginSize}" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="{StaticResource MarginSize}" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="24" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock Text="Name"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Right" />

        <TextBox VerticalAlignment="Center"
                 HorizontalAlignment="Stretch"
                 Text="{Binding NewDBName, UpdateSourceTrigger=PropertyChanged}"
                 Grid.Column="2" />

        <!--<TextBlock Text="TIP"
                   Grid.Row="3"
                   HorizontalAlignment="Right"
                   VerticalAlignment="Top" />-->

        <StackPanel Grid.Row="2"
                    Grid.Column="2">
            <TextBlock Text="Following symbols are not allowed:" />
            <TextBlock Text="\ / : * ? &quot; &lt; &gt; |" />
        </StackPanel>

        <StackPanel Grid.Row="4"
                    HorizontalAlignment="Right"
                    Orientation="Horizontal"
                    Grid.Column="2">

            <CheckBox Content="Add and open"
                      VerticalAlignment="Center"
                      IsChecked="{Binding AddAndOpen}"
                      Visibility="{Binding IsNotInEditMode, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}">
                <CheckBox.Margin>
                    <Thickness Right="{StaticResource MarginSizeValue}" />
                </CheckBox.Margin>
            </CheckBox>

            <Button Content="Ok"
                    MinWidth="80"
                    Command="{Binding ConfirmCommand, Mode=OneWay}">
                <Button.Margin>
                    <Thickness Right="{StaticResource MarginSizeValue}" />
                </Button.Margin>
            </Button>

            <Button Content="Cancel"
                    MinWidth="80"
                    Command="{Binding CancelCommand, Mode=OneWay}" />

        </StackPanel>

    </Grid>
</UserControl>